package com.yx.fx.webApi.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yx.fx.common.model.response.Outcome;
import com.yx.fx.webApi.entity.BankAccessInfo;
import com.yx.fx.webApi.param.BankAccessInfoParam;
import com.yx.fx.webApi.serviceImpl.BankAccessInfoServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author pxb
 * @since 2021-09-17
 */
@Api(tags = "银行访谈主表相关接口")
@RestController
@RequestMapping("/bankAccessInfo")
public class BankAccessInfoController {

    @Resource
    private BankAccessInfoServiceImpl bankAccessInfoServiceImpl;

    @GetMapping
    @ApiOperation("查询")
    public Outcome<IPage<BankAccessInfo>> page(BankAccessInfoParam param) {
        return Outcome.success(bankAccessInfoServiceImpl.getBankAccessInfoList(param));
    }

    @PostMapping
    @ApiOperation("新增或者变更")
    public Outcome saveOrUpdate(@RequestBody @Valid BankAccessInfo bankAccessInfo) {
        return Outcome.success(bankAccessInfoServiceImpl.saveOrUpdate(bankAccessInfo));
    }

    @DeleteMapping
    @ApiOperation("删除")
    public Outcome delete(@RequestBody @Valid @Size(min = 1) List<Long> id) {
        return Outcome.status(bankAccessInfoServiceImpl.delete(id));
    }


}

